package event;

import model.code.Structure;
import model.symbol.StructureMember;

/**
 * This is for events in which a {@link model.code.Structure} has a member added.
 *
 * @author Neil Dickson
 */
public class MemberAddedEvent extends SymbolChangeEvent {
	private	StructureMember	member;
	private	int				index;

	public MemberAddedEvent(Structure structure,StructureMember member,int index) {
		super(structure);
		this.member = member;
		this.index = index;
	}
	public Undoable undo() {
		((Structure)symbol).removeMember(index);
		return new MemberRemovedEvent((Structure)symbol,member,index);
	}

	public String getDescription() {
		return "Added "+symbol.getName()+" member "+member.getName();
	}
}
